Skip to content

Conversation

@aviroop-123
Copy link
Contributor

@aviroop-123 aviroop-123 commented Nov 19, 2025

  • Elides property initializers with implicit / explicit types.
  • Skips eliding constant properties and anonymous object property initializers.

https://youtrack.jetbrains.com/issue/KT-78422/

Fixes https://youtrack.jetbrains.com/issue/KT-82336/

@aviroop-123 aviroop-123 requested review from a team as code owners November 19, 2025 19:44
@FenstonSingel FenstonSingel requested review from demiurg906 and removed request for FenstonSingel and bashor November 19, 2025 20:57
@demiurg906 demiurg906 self-assigned this Nov 20, 2025
Copy link
Contributor

@demiurg906 demiurg906 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the comments above, could you please squash all commits in this branch into one?
They all are about the same thing with a small variations and it's not very practical to have them separated.

OFC fixes to comments would be nice to have in !fixup commits to this big squashed one.

if (!initializerIsAlreadyResolved) {
dataFlowAnalyzer.enterProperty(property)
}
else if (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch is actually useless, as you anyway remove the initializer in the end of the transformProperty.

else -> if (it.isExpression()) {
context.calleeNamesForLambda += null
propertyInitializer = withForcedLocalContext {
propertyInitializer = withForcedLocalContext(!isReturnType || modifiers?.isConst() == true) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting forceKeepingTheBodyInHeaderMode here actually doesn't do anything, as this property affects only transformFunctionBody, and here we call just getAsFirExpression, which unconditionally creates an expression.

Here you should just don't call getAsFirExpression if isReturnType && modifiers?.isConst() != true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants